<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>cors</title>
</head>
<body>
<script>
    let xhr=new XMLHttpRequest;
    document.cookie='zf';
    xhr.withCredentials=true;
    xhr.open('PUT','http://localhost:1234/getData',true);
    xhr.setRequestHeader('name','wangxin');
    xhr.onreadystatechange=function () {
        if(xhr.readyState===4){
            if(xhr.status>=200&&xhr.status<300||xhr.status===304){
                console.log(xhr.getResponseHeader('name'));
                console.log(xhr.response);
            }
        }
    }
    xhr.send()
</script>
</body>
</html>